package com.community.backend.context;

public class BaseContext {

    public static ThreadLocal<String> idThreadLocal = new ThreadLocal<>();//id
    public static ThreadLocal<String> nameThreadLocal = new ThreadLocal<>();// name
    public static ThreadLocal<String> roleThreadLocal = new ThreadLocal<>();// role


    public static void setCurrentId(String id) {
        idThreadLocal.set(id);
    }

    public static String getCurrentId() {
        return idThreadLocal.get();
    }

    public static void removeCurrentId() {
        idThreadLocal.remove();
    }


    public static void setCurrentName(String name) {
        nameThreadLocal.set(name);
    }
    public static String getCurrentName() {
        return nameThreadLocal.get();
    }
    public static void removeCurrentName() {
        nameThreadLocal.remove();
    }
    public static void setCurrentRole(String role) {
        roleThreadLocal.set(role);
    }
    public static String getCurrentRole() {
        return roleThreadLocal.get();
    }
    public static void removeCurrentRole() {
        roleThreadLocal.remove();
    }
}
